%by clq
function []=figure6(i_best,TotalP,TotalPP,TotalR,TotalRP)
%need to input i_best,TotalP,TotalPP,TotalR,TotalRP
%%%%%%%%%%%%%%%%%%%%%%%%p=(0.25,0.5,0.9)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%call_in_sequence=[2 2 1 3 3 3 3 3 2 2 1 2 3 3 3 3 1 1 2 1 3 1 2 3 1 1 1 2 3 1 2 3 3 1 2 1 3 3 2 2 2 1 1 2 1 1 2 1]
P=(0.25,0.5,0.9)
%------------------------calling other functions------------------------%

%proposed policy
[best_is,opt_profits]=proposed(j_all)
%proposed policy with preference
[best_is_pref,opt_profits_pref]=proposed_pref(j_all)
%round robin
[i_R,profits_R]=round_robin(j_all)
%round robin with preference
[i_RP,profits_RP]=round_robin_pref(j_all)


%first draw the expected profit
yyaxis left;
plot(1:n,opt_profits,'-');
hold on; plot(1:n,profits_R,'--');
hold on; plot(1:n,opt_profits_pref,'.:');
hold on; plot(1:n,profits_RP,'.--');
legend('Proposed Policy','Round Robin','Prop. Policy with Pref.','Round Robin with Pref.','Location','NorthWest')

%then mark the best slot
yyaxis right;
hold on; stem(1:n,best_is,'o:');


%at last different labels
ylabel('Expected Profit');
xlabel('Sequence of patient types');
yyaxis left;
xticklabels({'','2','2','1','3','3','3','3','3','2','2','1','2','3','3','3','3','1','1','2','1','3','1','2','3','1','1','1','2','3','1','2','3','3','1','2','1','3','3','2','2','2','1','1','2','1','1','2','1'});
yticklabels('','1:(1,2,2)','2:(3,1,1)','3:(0,3,1)','4:(0,3,1)','5:(1,0,2)','6:(4,0,2)','7:(0,0,2)','8:(1,0,1)')

%different lines and marks
%need to be adjusted    
%hold on; line([24,24],[0,1800],'Linewidth','5');
%hold on; line([27,27],[0,1800],'Linewidth','5');